From 10a759f349c4c4f4224ee2470f0968b9c24d9418 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Fri, 28 Oct 2022 08:18:46 -0600 Subject: [PATCH] fix perlcritic issues with makedoc. --- xmldoc/makedoc | 78 +++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/xmldoc/makedoc b/xmldoc/makedoc index a233f25cc..9c8a1049e 100755 --- a/xmldoc/makedoc +++ b/xmldoc/makedoc @@ -5,12 +5,11 @@ use warnings; use File::Basename; -# -# makedoc.in is used to generate makedoc. Editing makedoc is a bad idea. -# - my %options; my $dir; +my $parts; +my $formats; +my $file; sub expandrw { my $read = shift; @@ -77,8 +76,8 @@ sub include { my $d2 = $dir2; $d2 =~ s:/.*::; $name2 = $d2 . '_' . $name2; - print PARTS qq(\n); - print FILE "\&inc_$name2;\n"; + print $parts qq(\n); + print $file "\&inc_$name2;\n"; if ( !-e "$dir/$dir2/$name.xml" ) { open my $tmp, '>', "$dir/$dir2/$name.xml" or die $!; print $tmp "\n"; @@ -91,8 +90,8 @@ sub includef { my $name2 = $name; $name2 =~ s/-/_/g; - print PARTS qq(\n); - print FORMATS "\&inc_$name2;\n"; + print $parts qq(\n); + print $formats "\&inc_$name2;\n"; } $dir = dirname($0); @@ -101,13 +100,13 @@ qx(mkdir -p $dir/autogen); if ( $? != 0 ) { die "error creating autogen directory: $?"; } -open PARTS, ">$dir/autogen/_parts.xml"; -print PARTS qq(\n); -print PARTS qq(\n); -print PARTS qq(\n); +open $parts, '>', "$dir/autogen/_parts.xml" or die $!; +print $parts qq(\n); +print $parts qq(\n); +print $parts qq(\n); -open FORMATS, ">$dir/autogen/_formats.xml"; -print FORMATS qq(\n); +open $formats, '>', "$dir/autogen/_formats.xml" or die $!; +print $formats qq(\n); my @formats = qx(./gpsbabel -^3); if ( $? != 0 ) { @@ -165,8 +164,8 @@ for (@formats) { if ( $line[0] eq 'internal' ) { if ($going) { - print FILE "\n"; - close FILE; + print $file "\n"; + close $file; $going = 0; } if ( $line[5] eq 'xcsv' ) { @@ -176,8 +175,8 @@ for (@formats) { if ( ( $line[0] eq 'file' ) || ( $line[0] eq 'serial' ) ) { if ($going) { - print FILE "\n"; - close FILE; + print $file "\n"; + close $file; } $id = $line[2]; if ( $fmts{$id} ) { @@ -187,19 +186,19 @@ for (@formats) { $fmts{$id} = 1; } includef( 'fmt_' . $id ); - open FILE, ">$dir/autogen/fmt_$id.xml"; - print FILE <', "$dir/autogen/fmt_$id.xml" or die $!; + print $file <
$line[4] ($line[2]) END - print FILE expandoptions( $line[1] ); - print FILE expandsuboptions($id); + print $file expandoptions( $line[1] ); + print $file expandsuboptions($id); $going = 1; $dooptions = 1; if ( defined( $line[5] ) && ( $line[5] ne $line[2] ) ) { - print FILE < This format is derived from the $line[5] format, so it has all of the same options as that format. @@ -213,7 +212,7 @@ END } elsif ( $going && $dooptions && ( $line[0] eq 'option' ) ) { my $nid = 'fmt_' . $id . '_o_' . $line[2]; - print FILE < <option>$line[2]</option> option @@ -221,20 +220,21 @@ END END include( $id . '-' . $line[2], "formats/options" ); - print FILE < END } } if ($going) { - print FILE "
\n"; - close FILE; + print $file "\n"; + close $file; $going = 0; } -open FORMATS, ">$dir/autogen/_filters.xml"; -print FORMATS qq(\n); +close $formats; +open $formats, '>', "$dir/autogen/_filters.xml" or die $!; +print $formats qq(\n); my @filters = qx(./gpsbabel -%1); if ( $? != 0 ) { @@ -251,7 +251,7 @@ for (@filters) { my @line = split "\t"; if ( $going && ( $line[0] eq 'option' ) ) { - print FILE < $line[2] option @@ -259,18 +259,18 @@ for (@filters) { END include( $line[1] . '-' . $line[2], "filters/options" ); - print FILE < END } else { if ($going) { - print FILE "\n"; - close FILE; + print $file "\n"; + close $file; } includef( 'filter_' . $line[0] ); - open FILE, ">$dir/autogen/filter_$line[0].xml"; - print FILE <', "$dir/autogen/filter_$line[0].xml" or die $!; + print $file <
$line[1] ($line[0]) @@ -281,9 +281,9 @@ END } if ($going) { - print FILE "
\n"; - close FILE; + print $file "\n"; + close $file; $going = 0; } -close FORMATS; -close PARTS; +close $formats; +close $parts; -- 2.30.2